package com.huicharge.huichargecrm.result;

import lombok.Data;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * @program: personal-charge-core
 * @description:
 * @author: Qing Jun
 * @create: 2024-07-29  17:02
 **/
@Data
@Accessors(chain = true)
public class PageResult<T> {

    private Long page;

    private Long pageSize;

    private Long total;

    private List<T> data;

    public PageResult<T> init(Long page, Long pageSize, Long total, List<T> data) {
        this.page = page;
        this.pageSize = pageSize;
        this.total = total;
        this.data = data;
        return this;
    }

    public PageResult<T> init(Integer page, Integer pageSize, Long total, List<T> data) {
        this.page = Long.valueOf(page);
        this.pageSize = Long.valueOf(pageSize);
        this.total = total;
        this.data = data;
        return this;
    }
}
